package com.slz3.business.module.systemManagement.sysFunction.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysFunction.domain.SysFunction;
import com.slz3.business.module.systemManagement.sysFunction.domain.SysFunctionFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysFunctionTransactionalServiceImpl implements SysFunctionTransactionalService {

    @Override
    public SysFunction modify(SysFunction sysFunctionNew) {
        Repositorys.sysFunction.test();
        Repositorys.sysFunction.save(SysFunctionFactory.initBaseFields());
        System.err.println(1/0);
        sysFunctionNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysFunction.saveAndFlush(sysFunctionNew);
    }

    @Override
    public List<SysFunction> batchModify(List<SysFunction> sysFunctionList) {
        return Repositorys.sysFunction.saveAll(sysFunctionList);
    }
}
